﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="zhanyemeitiyuce_ssq_historylist.aspx.cs" Inherits="zhanyemeitiyuce_ssq_historylist" Title="专业媒体历史预测记录" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>专业媒体历史预测记录</title>
    <script src="App_Themes/js/jiangjinjisuan/jquery-1.js" type="text/javascript"></script>

    <link href="App_Themes/css/webstyle.css" rel="stylesheet" />
    <link href="App_Themes/js/jiangjinjisuan/i6Fzam6N7fIj.css" rel="stylesheet" />
    <link href="App_Themes/js/jiangjinjisuan/szc-tools.css" rel="stylesheet" />
    <link href="App_Themes/js/jiangjinjisuan/mod.count.css" rel="stylesheet" />
    <script src="App_Themes/js/jiangjinjisuan/jquery.page.js" type="text/javascript"></script>
    <style type="text/css">
        .top_bg {
            background: #c41921;
        }

            .top_bg a {
                color: #fff;
            }

        .top_list {
            background: #c41921;
            color: #fff;
            text-align: center;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            float: left;
            padding: 0 30px;
        }

        .top_list1 {
            color: #fff;
            text-align: center;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            background: url(images/kjdb_icon2.jpg) no-repeat center bottom #fd2e37;
            float: left;
            padding: 0 30px;
        }

        .fxui-tab1 {
            border: solid 1px #e5e5e5;
        }

            .fxui-tab1 .fxui-tab-hand1 {
                border: solid 1px #c7b0b7;
                height: 26px;
                line-height: 26px;
            }

            .fxui-tab1 .fxui-tab-tit1 {
                display: block;
                float: left;
                cursor: pointer;
                text-align: center;
                padding: 0 12px;
                color: #3a3a3a;
                font-size: 14px;
            }

            .fxui-tab1 .fxui-tab-hand1 .curr {
                color: #fff;
                background: #c41921;
            }

            .fxui-tab1 .fxui-tab-nav1 {
            }


        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        a {
            text-decoration: none;
        }

            a:hover {
                text-decoration: none;
            }

        .tcdPageCode {
            padding: 15px 20px;
            text-align: left;
            color: #ccc;
            text-align: center;
        }

            .tcdPageCode a {
                display: inline-block;
                color: #428bca;
                display: inline-block;
                height: 25px;
                line-height: 25px;
                padding: 0 10px;
                border: 1px solid #ddd;
                margin: 0 2px;
                border-radius: 4px;
                vertical-align: middle;
            }

                .tcdPageCode a:hover {
                    text-decoration: none;
                    border: 1px solid #428bca;
                }

            .tcdPageCode span.current {
                display: inline-block;
                height: 25px;
                line-height: 25px;
                padding: 0 10px;
                margin: 0 2px;
                color: #fff;
                background-color: #428bca;
                border: 1px solid #428bca;
                border-radius: 4px;
                vertical-align: middle;
            }

            .tcdPageCode span.disabled {
                display: inline-block;
                height: 25px;
                line-height: 25px;
                padding: 0 10px;
                margin: 0 2px;
                color: #bfbfbf;
                background: #f2f2f2;
                border: 1px solid #bfbfbf;
                border-radius: 4px;
                vertical-align: middle;
            }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            forecastOtherData();
            pageList();//分页
            forecastList(1);
            $("input[name=autobuy_record]").click(function () {
                forecastList(1);
            });

        }
   );
        function forecastOtherData()
        {
            var id=<%=Request.QueryString["id"].ToString()%>;
            $.ajax({
                url: "/Ajax/LotteryData.ashx",
                data: { t: 'GetForecastData_ByMediaId', id: id, LotteryType: 1 },//开奖号码
                type: "get",
                dataType: "json",
                success: function (data) {
                    $("#mediaName").text(data.MediaName);
                    $("#ForecastCount").text(data.ForecastQSCount);
                    $("#HistoryWinRute").text(data.WonRate);
                    $("#AvgMRedBall").text(data.RedBall_AverageMZCount);
                    $("#AvgMBlueBall").text(data.BlueBall_AverageMZRate);
                    if(data.MZ_Most.length>0)
                    {
                        $("#MZ_Most").text(data.MZ_Most);
                    }
                    else
                    {
                        $("#MZ_Most").text("未命中");
                    }
                   
                }
            });
        }
        //媒体信息
        function pageList() {
            var id=<%=Request.QueryString["id"].ToString()%>;
            $.ajax({
                url: "/Ajax/LotteryData.ashx",
                data: { t: 'GetForecastbyMedia_PageCount', id: id, LotteryType: 1 },//开奖号码
                type: "get",
                dataType: "json",
                success: function (data) {
                    $(".tcdPageCode").createPage({  //翻页
                        pageCount: data,//总页数
                        current: 1,//当前页
                        backFn: function (p) {
                            forecastList(p);
                        }
                    });

                }
            });
        }
        //历史列表
        function forecastList(pageCurrent)
        {
            var id=<%=Request.QueryString["id"].ToString()%>;
            var paixuType = "";
            $(":radio").each(function () {
                if ($(this).attr("checked")) {
                    paixuType = $('input:radio:checked').val();
                }
            });
            $.ajax({
                url: "/Ajax/LotteryData.ashx",
                data: { t: 'GetForecastListByMediaId', id:id, lotteryType: 1, currentPageIndex: pageCurrent, paixuType: paixuType },//获取预测列表数据
                type: "get",
                dataType: "json",
                success: function (data) {
                    if (data.length != 0) {
                        var t = document.getElementById("autobuy_list"); //获取展示数据的表格
                        while (t.rows.length != 0) {
                            t.removeChild(t.rows[0]); //在读取数据时如果表格已存在行．一律删除
                        }
                    }
                    var str = "";
                    $.each(data, function (i, item) {
                     
                        if (item.LotteryNo =="等待开奖") {
                            str+="<tr><td>"+item.LotteryQS+"</td>";
                            str+=" <td>等待开奖</td>";
                            str+="<td>"+item.ForecastNo+"<td>";
                            str+="<td>等待开奖</td></tr>"; 
                        }
                        else {
                            str+="<tr><td>"+item.LotteryQS+"</td>";
                            str+=" <td><em class='red'>"+item.RedBall+"</em>+<em class='blue'>"+item.BlueBall+"</em></td>";
                            str+="<td>"+DrawForecastRedBall(item.ForecastNo.split('+')[0],item.RedBall)+"+"+DrawForecastBlueBall(item.ForecastNo.split('+')[1],item.BlueBall)+"<td>";
                            str+="<td>"+ConvertWinLevel(item.WinLevel)+"</td></tr>";
                        }
                       
                    })
                 
                    $("#autobuy_list").html(str);
                },
                error: function () {
                    var t = document.getElementById("autobuy_list"); //获取展示数据的表格
                    while (t.rows.length != 0) {
                        t.removeChild(t.rows[0]); //在读取数据时如果表格已存在行．一律删除
                    }
                    //alert("加载数据失败");
                } //加载失败，请求错误处理
            });
        }
        function ConvertWinLevel(level)
        {
            var text="";
            if(level=-1)
            {
                text="未中奖";
            }
            else if(level==1)
            {
                text="一等奖";
            }
            else if(level=2)
            {
                text="二等奖";
            }
            else if(level=3)
            {
                text="三等奖";
            }
            else if(level=4)
            {
                text="四等奖";
            }
            else if(level=5)
            {
                text="五等奖";
            }
            else
            {
                text="六等奖";
            }
            return text;
        }
        function DrawForecastRedBall(ForeRed,red)
        {
            var fr=ForeRed.split(' ');
            var r=red.split(' ');
            var str="";
            //var n = {},arr=[]; //n为hash表，arr为临时数组
            //for(var i=0;i<fr.length;i++)
            //{                      
            //    for(var j=0;j<r.length;j++)
            //    {
            //        if(fr[i]==r[j])
            //        {     
            //            if(!n[fr[i]])
            //            {
            //                n[fr[i]]=true;      
            //                //arr.push(fr[i]);
            //                str+="<b class='red'>"+fr[i]+"</b> ";   
            //            }
            //        }
            //        else
            //        {                            
            //            if(!n[fr[i]])
            //            {
            //                //arr.push(fr[i]);   
            //                n[fr[i]]=true;        
            //                str+=fr[i]+" ";
            //            }                      
            //        }
            //    }
            //}

            var temp1=[];
            var temp2=[];
            for(var j=0;j<r.length;j++)
            {
                temp1[r[j]]=true;
            }
            for(var i=0;i<fr.length;i++)
            {
                if(!temp1[fr[i]])
                {
                    temp2.push(fr[i]);
                    str+=fr[i]+" ";
                }
                else
                {
                    str+="<b class='red'>"+fr[i]+"</b> ";   
                }
            }
            return str;
        }
        function DrawForecastBlueBall(ForeBlue,blue)
        {
            var fb=ForeBlue.split(' ');
            var str="";
            var n = {},arr=[]; //n为hash表，arr为临时数组
            for(var i=0;i<fb.length;i++)
            {
                if(fb[i]==blue)
                {
                    if(!n[fb[i]])
                    {
                        n[fb[i]]=true;
                        str+="<b class='blue'>"+fb[i]+"</b>";
                    }                       
                }
                else
                {
                    if(!n[fb[i]])
                    {
                        n[fb[i]]=true;
                        str+=fb[i]+" ";
                    }                    
                }
            }
            return str;
        }
       
    </script>
</head>
<body>
    <%--    <div style="position: absolute; z-index: 10002; visibility: visible; float: left; top: 213.5px; left: 639.5px;"></div>--%>
    <%--    <div style="position: relative;" class="panel panel-t1 panel-gd panel-gd2"> </div>--%>
    <div class="panel-content">
        <div class="bd">
            <div class="panel-gd-bd relative" style="height: 467px;">
                <div class="panel-gd-s">
                    <div class="f">
                        <h3>
                            <asp:Label ID="mediaName" runat="server"></asp:Label></h3>
                        <ul>
                            <li>预测期数：<asp:Label ID="ForecastCount" runat="server"></asp:Label>次</li>
                            <li>历史中奖率：<asp:Label ID="HistoryWinRute" runat="server"></asp:Label>%</li>
                            <li>红球平均命中数：<asp:Label ID="AvgMRedBall" runat="server"></asp:Label>个</li>
                            <li>蓝球平均命中率：<asp:Label ID="AvgMBlueBall" runat="server"></asp:Label>%</li>
                            <li class="w">最高命中：
                                <asp:Label ID="MZ_Most" runat="server"></asp:Label></li>
                        </ul>
                    </div>
                </div>
                <div class="panel-gd-s2">
                    <div class="ln">
                        <span class="c">预测记录：</span>
                        <label class="r">
                            <input value="0" name="autobuy_record" checked="checked" type="radio" order="0">按期次排序

                        </label>
                        <label class="r">
                            <input value="1" name="autobuy_record" type="radio" order="1">按命中奖级排序</label>

                    </div>
                </div>
                <div class="table">
                    <table>
                        <thead>
                            <tr>
                                <th>期次</th>
                                <th>开奖号码</th>
                                <th>预测号码</th>
                                <th></th>
                                <th>当期命中</th>

                            </tr>
                        </thead>
                        <tbody id="autobuy_list">
                        </tbody>
                    </table>
                </div>
                <div class="tcdPageCode">
                </div>
                <center>
                   <pre><br /></pre>
                </center>
            </div>
        </div>
    </div>
</body>
</html>
